import Request from '@/utils/request'
import Cookies from '@/utils/auth'

const state = () => ({
	nftdDetail: {},
})
const getters = {
	
}
const mutations = {
	set_nftdDetail: (state, data) => {
		state.nftdDetail = data
	},
}
const actions = {
	async get_collection_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/nft/collection/list',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_collection_countrys({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/arLandmark/country',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_collection_detail({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/nft/getDetail',params)
			.then(res=>{
				if(res.data.success){
					commit('set_nftdDetail',res.data.data)
				}
				resolve(res.data) 
			})
		})
	},
	async get_bid_record({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/trade/bidLogList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async cancel_sale({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/trade/cancel',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},

	async get_number_goods_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/goods/collectionList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_number_goods_detail({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/goods/collectionDetail',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async release_sell({commit}, params) {   //发布寄售
		return new Promise((resolve,reject)=>{
			Request.post('/api/trade/userConsignmentRelease',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},

}

export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
